<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>租赁编辑</title>
<%-- <link rel="stylesheet" type="text/css"
	href="<%=basePath%>static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>static/h-ui.admin/skin/default/skin.css" id="skin" /> --%>
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/css/style.css" />
<link rel="stylesheet" href="<%=basePath%>static/layer/2.4/skin/layer.css">
<script src="<%=basePath%>lib/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=basePath%>lib/layer/2.4/layer.js"></script>
</head>
<style type="text/css">

body{
	background:#f6f6f6;
}

*{
	margin:0;
	padding:0;
}

.input-text{
	width:200px;
	height:36px;
	color:#000;
	border:1px solid #ddd;
	border-radius:3px;
	margin-left:10px;
	font-size:16px;
	padding-left:56px
}

.btn-text{
	width:257px;
	height:36px;
	text-align:center;
	border:1px solid #ddd;
	border-radius:3px;
	margin-left:10px;
	background:#118c60;
	color:#fff;
	font-size:16px;
	opacity:0.85;
}

.btn-text:hover{
	border:1px solid #fff;
	opacity:1;
	cursor:pointer;
}


.re_css{
    width:180px;
    height:74px;
    margin-top:15px;
    position:relative;
}
.la{
	width:64px;
	height: 40px;
	line-height: 40px;
	display: inline-block;
	text-align: right;
	font-size:16px;
}


.reg_css{
	width:200px;
	height:60px;
}
.reg_t{
	width:237px;
	height:182px;
	position: relative;
	margin: auto;
	top: 10px;
	font-size: 19px;
	text-align: center;
	line-height: 60px;
}

.ci{
	position: absolute;
	top: 4px;
	left: 150px;
	font-size: 24px;
	background: #f2f2f2;
	height: 32px;
	width: 32px;
	text-align: center;
	margin-top: 2px;
	line-height: 34px;
}

.layercss{
	position:fixed;
	z-index:19910103;
	top:50%;
	left:50%;
	width:80px;
	height:30px;
	background:#000;
	opacity:0.6;
	color:#fff;
	line-height:30px;
	text-align:center;
}
</style>

<body>

<div class="reg_t">
	<form action="" id="zlod" method="post">
		<div class="re_css">
			<lable class="la">地址：</lable>
			<input type="text" class="input-text" name="store" id="stores" onblur="f1()" />
		</div>
		<div class="re_css">
			<input type="button" class="btn-text" value="保存" onclick="tijiao()"/>
		</div>
	</form>
</div>

<script type="text/javascript">
	function tijiao() {
		var store=$("#stores").val();
		/* alert(store); */
		if(store==null&&store==""){
			
			layer.msg("门店已存在");
			return false;
		}else{
			
			var store=$("#stores").val();
			
			 $.ajax({
	             type: "POST",
	             data:{store:store},
	             url: "checkStore",
	             dataType:"json",
	             success: function(data){
	              if(data==true){
	            	  layer.msg("门店已存在");
	            	  return false;
	              }else{
	            	 
	            	  
	          		
	         		 $.ajax({  
	                      cache: true,  
	                      type: "POST",  
	                      url:"newStore",  
	                      data:$('#zlod').serialize(),// 你的formid  
	                      async: false,  
	                      error: function(request) {  
	                     	 console.log("ajax异常");
	                      },  
	                      success: function(data) {  
	                     	 $("body").append('<div class="layercss">添加成功</div>');
	         				   $(".layercss").fadeOut(1500);
	         				  setTimeout(function(){ index = parent.layer.getFrameIndex(window.name);
	         				        parent.layer.close(index);
	         				        },1500);  
	                      }  
	                  }); 
	              }
	        
	             }
	            
	             
	         });
			
		}
  
	}
	function f1(){
		var store=$("#stores").val();
		if(store==null){
			return false;
			 layer.msg("门店不能为空");
		}else if(store==""){
			 layer.msg("门店不能为空");
			return false;
		}else{
			 $.ajax({
		            type: "POST",
		            data:{store:store},
		            url: "checkStore",
		            dataType:"json",
		            success: function(data){
		             if(data==true){
		            	 layer.msg("门店已存在");
		           	 /*  alert("门店已存在"); */
		           	  return false;
		             }
		       
		            }
		           
		            
		        });
		}
		
		
		
	}


</script>
</body>
</html>